package cn.dz.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName MvcConfig
 * @package: cn.dz.config
 * @Description TODO
 * @Author dz
 * @Date 2024/12/22 16:46
 * @Version 1.0
 **/
@Configuration
public class MvcConfig implements WebMvcConfigurer {

    //通过这里面配置，不需要为每一个访问thymeleaf模板页面单独开发一个Controller请求了
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        // viewController 请求路径  viewName: 跳转视图
        registry.addViewController("login").setViewName("login");
        registry.addViewController("regist").setViewName("regist");
        registry.addViewController("addEmp").setViewName("addEmp");
        registry.addViewController("updateEmp").setViewName("updateEmp");
        //WebMvcConfigurer.super.addViewControllers(registry);
    }
}
